<template>
  <div class="detailGood f-d-c">
    <div
      class="shanping f-a-c f-j-sb-a-c click"
      v-for="(item, index) in productList"
      :key="index"
      @click="godetail(item)"
    >
      <div class="f-a-c" style="align-items: flex-start">
        <div class="img">
          <img :src="item.bannerimg" alt="" />
        </div>
        <div class="produceDetail">
          <div class="productTop">
            <span class="ellipsis" style="width:180px;display: block;">{{ item.title }}</span>
            <svg-icon class="click" name="icon-download"></svg-icon>
            <span>{{ item.downLoad }}</span>
          </div>
          <div class="content ellipsis2">
            {{ item.content }}
          </div>
        </div>
      </div>
      <div class="user">
        <img :src="item.userImgs" alt="" />
      </div>
    </div>
  </div>
</template>

<script>
import { useRouter } from "vue-router";
import {
  computed,
  defineComponent,
  onMounted,
  reactive,
  toRefs,
  getCurrentInstance,
  onUnmounted,
} from "vue";
import { useStore } from "vuex";
import { emit } from "process";
export default defineComponent({
  props: {
    productList: {
      type: Array,
      default: () => [],
    },
  },

  setup(props, { attrs, slots, emit }) {
    let userInfo = computed(() => {
      return store.state.minUserInfo;
    });
    const router = useRouter();
    const { proxy } = getCurrentInstance();
    let store = useStore();
    let data = reactive({});
    let godetail = (item) => {
      console.log(item, "asdads");
      emit("godetailssss", item);
    };
    onMounted(() => {});
    onUnmounted(() => {});
    return {
      userInfo,
      godetail,
      ...toRefs(data),
    };
  },
});
</script>
<style lang="scss" scoped>
.detailGood {
  margin-top: 10px;
  .shanping {
    padding: 10px;

    width: 460px;
    height: 100px;
    background: #f7f9fa;
    border-radius: 20px 20px 20px 20px;

    margin-bottom: 10px;
    .img {
      > img {
        object-fit:cover;
        width: 80px;
        height: 80px;
        border-radius: 20px 20px 20px 20px;
      }
    }
  }
  .produceDetail {
    margin-left: 20px;
    .productTop {
      > span {
        margin-right: 11px;
        font-size: 14px;
        font-family: Microsoft YaHei-Bold, Microsoft YaHei;
        font-weight: 700;
        color: #000000;
        &:last-child {
          margin-left: 6px;
          font-size: 12px;
          font-family: Microsoft YaHei-Regular, Microsoft YaHei;
          font-weight: 400;
          color: #656f79;
        }
      }
    }
    .content {
      margin-top: 10px;
      line-height: 18px;
      width: 256px;
      font-size: 14px;
      font-family: Microsoft YaHei-Regular, Microsoft YaHei;
      font-weight: 400;
      color: #656f79;
    }
  }
  .user {
    > img {
      border-radius: 50%;
      width: 48px;
      height: 48px;
      opacity: 1;
    }
  }
}
</style>
